
from basic.base_requests import MerchantRequests

class URL:
    ORDER_LIST="/api/admin/merchant/order/list"
    ORDER_INFO="/api/admin/merchant/order/info"
    ORDER_VERIFICATION="/api/admin/merchant/order/verification"

class MerchantOrder(MerchantRequests,URL):

    def merchant_order_list(self,status='all',date_limit=None,order_no=None,type=None,searchType="all",content=None):
        """
        订单列表
        :param status: 订单状态
        :param date_limit: 时间范围
        :param oeder_No: 订单编号
        :param type: 订单类型
        :return:
        """
        params = {
            'status': status,
            'dateLimit': date_limit,
            'orderNo': order_no,
            'page': '1',
            'limit': '20',
            'type': type,
            'searchType': searchType,
            'content': content,
            'temp': '1756110372',
        }
        # logger.info(f"接口{self.merchant_order_list.__name__}请求信息为{params}")
        response = self.get(self.merchant_order_list.__name__, self.ORDER_LIST, params=params)
        # logger.info(f"接口{self.merchant_order_list.__name__}响应信息为{response}")
        return response

    def merchant_order_info(self,order_no):
        """
        订单详情
        """
        url=f"{self.ORDER_INFO}/{order_no}"
        response = self.get(self.merchant_order_info.__name__,url=url)
        # logger.info(f"接口{self.merchant_order_info.__name__}请求信息为{params}")
        # logger.info(f"接口响应信息为:{response.json()}")
        return response

    def merchant_order_verification(self,verifyCode):
        """
        订单核销
        """
        json={
            'verifyCode': verifyCode
        }
        response = self.get(self.merchant_order_verification.__name__, self.ORDER_VERIFICATION,json=json)
        # logger.info(f"接口{self.merchant_order_verification.__name__}请求信息为{json_data}")
        # logger.info(f"接口{self.merchant_order_verification.__name__}响应信息为{response.json()}")
        return response



if __name__ == '__main__':
    merchant_order = MerchantOrder()
    merchant_order.merchant_order_info("SH380175587621251897456")
